.class Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;
.super Ljava/util/TimerTask;
.source "LbsManager.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/peptalk/client/lbs/android/LbsManager;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "LbsTimerTask"
.end annotation


# instance fields
.field private listener:Landroid/location/LocationListener;

.field private looper:Landroid/os/Looper;

.field private minDistance:F

.field final synthetic this$0:Lcom/peptalk/client/lbs/android/LbsManager;


# direct methods
.method public constructor <init>(Lcom/peptalk/client/lbs/android/LbsManager;Landroid/location/LocationListener;FLandroid/os/Looper;)V
    .locals 0
    .parameter
    .parameter "listener"
    .parameter "minDistance"
    .parameter "looper"

    .prologue
    .line 254
    iput-object p1, p0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->this$0:Lcom/peptalk/client/lbs/android/LbsManager;

    .line 250
    invoke-direct {p0}, Ljava/util/TimerTask;-><init>()V

    .line 251
    iput-object p2, p0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->listener:Landroid/location/LocationListener;

    .line 252
    iput-object p4, p0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->looper:Landroid/os/Looper;

    .line 253
    iput p3, p0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->minDistance:F

    return-void
.end method


# virtual methods
.method public run()V
    .locals 22

    .prologue
    .line 258
    new-instance v18, Landroid/location/Location;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->this$0:Lcom/peptalk/client/lbs/android/LbsManager;

    move-object v3, v0

    invoke-static {v3}, Lcom/peptalk/client/lbs/android/LbsManager;->access$13(Lcom/peptalk/client/lbs/android/LbsManager;)Landroid/location/Location;

    move-result-object v3

    move-object/from16 v0, v18

    move-object v1, v3

    invoke-direct {v0, v1}, Landroid/location/Location;-><init>(Landroid/location/Location;)V

    .line 260
    .local v18, location:Landroid/location/Location;
    :try_start_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->this$0:Lcom/peptalk/client/lbs/android/LbsManager;

    move-object v3, v0

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->this$0:Lcom/peptalk/client/lbs/android/LbsManager;

    move-object v4, v0

    const-wide/16 v5, 0x2710

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->looper:Landroid/os/Looper;

    move-object v7, v0

    invoke-virtual {v4, v5, v6, v7}, Lcom/peptalk/client/lbs/android/LbsManager;->requestLbsCipherText(JLandroid/os/Looper;)Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Lcom/peptalk/client/lbs/android/LbsManager;->access$14(Lcom/peptalk/client/lbs/android/LbsManager;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v21

    .line 261
    .local v21, xml:Ljava/lang/String;
    if-eqz v21, :cond_0

    .line 262
    new-instance v16, Ljava/io/ByteArrayInputStream;

    invoke-virtual/range {v21 .. v21}, Ljava/lang/String;->getBytes()[B

    move-result-object v3

    move-object/from16 v0, v16

    move-object v1, v3

    invoke-direct {v0, v1}, Ljava/io/ByteArrayInputStream;-><init>([B)V

    .line 263
    .local v16, is:Ljava/io/InputStream;
    invoke-static {}, Ljavax/xml/parsers/DocumentBuilderFactory;->newInstance()Ljavax/xml/parsers/DocumentBuilderFactory;

    move-result-object v14

    .line 265
    .local v14, dbf:Ljavax/xml/parsers/DocumentBuilderFactory;
    invoke-virtual {v14}, Ljavax/xml/parsers/DocumentBuilderFactory;->newDocumentBuilder()Ljavax/xml/parsers/DocumentBuilder;

    move-result-object v13

    .line 266
    .local v13, builder:Ljavax/xml/parsers/DocumentBuilder;
    move-object v0, v13

    move-object/from16 v1, v16

    invoke-virtual {v0, v1}, Ljavax/xml/parsers/DocumentBuilder;->parse(Ljava/io/InputStream;)Lorg/w3c/dom/Document;

    move-result-object v15

    .line 267
    .local v15, doc:Lorg/w3c/dom/Document;
    invoke-interface {v15}, Lorg/w3c/dom/Document;->getDocumentElement()Lorg/w3c/dom/Element;

    move-result-object v20

    .line 268
    .local v20, root:Lorg/w3c/dom/Element;
    const-string v3, "lon"

    move-object/from16 v0, v20

    move-object v1, v3

    invoke-interface {v0, v1}, Lorg/w3c/dom/Element;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v19

    .line 269
    .local v19, lon:Ljava/lang/String;
    const-string v3, "lat"

    move-object/from16 v0, v20

    move-object v1, v3

    invoke-interface {v0, v1}, Lorg/w3c/dom/Element;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v17

    .line 270
    .local v17, lat:Ljava/lang/String;
    const-string v3, "range"

    move-object/from16 v0, v20

    move-object v1, v3

    invoke-interface {v0, v1}, Lorg/w3c/dom/Element;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v12

    .line 271
    .local v12, acc:Ljava/lang/String;
    invoke-static/range {v19 .. v19}, Ljava/lang/Double;->parseDouble(Ljava/lang/String;)D

    move-result-wide v3

    move-object/from16 v0, v18

    move-wide v1, v3

    invoke-virtual {v0, v1, v2}, Landroid/location/Location;->setLongitude(D)V

    .line 272
    invoke-static/range {v17 .. v17}, Ljava/lang/Double;->parseDouble(Ljava/lang/String;)D

    move-result-wide v3

    move-object/from16 v0, v18

    move-wide v1, v3

    invoke-virtual {v0, v1, v2}, Landroid/location/Location;->setLatitude(D)V

    .line 273
    invoke-static {v12}, Ljava/lang/Float;->parseFloat(Ljava/lang/String;)F

    move-result v3

    move-object/from16 v0, v18

    move v1, v3

    invoke-virtual {v0, v1}, Landroid/location/Location;->setAccuracy(F)V

    .line 274
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v3

    move-object/from16 v0, v18

    move-wide v1, v3

    invoke-virtual {v0, v1, v2}, Landroid/location/Location;->setTime(J)V

    .line 275
    const/4 v3, 0x3

    new-array v11, v3, [F

    .line 276
    .local v11, results:[F
    invoke-static/range {v17 .. v17}, Ljava/lang/Double;->parseDouble(Ljava/lang/String;)D

    move-result-wide v3

    invoke-static/range {v19 .. v19}, Ljava/lang/Double;->parseDouble(Ljava/lang/String;)D

    move-result-wide v5

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->this$0:Lcom/peptalk/client/lbs/android/LbsManager;

    move-object v7, v0

    invoke-static {v7}, Lcom/peptalk/client/lbs/android/LbsManager;->access$13(Lcom/peptalk/client/lbs/android/LbsManager;)Landroid/location/Location;

    move-result-object v7

    invoke-virtual {v7}, Landroid/location/Location;->getLatitude()D

    move-result-wide v7

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->this$0:Lcom/peptalk/client/lbs/android/LbsManager;

    move-object v9, v0

    invoke-static {v9}, Lcom/peptalk/client/lbs/android/LbsManager;->access$13(Lcom/peptalk/client/lbs/android/LbsManager;)Landroid/location/Location;

    move-result-object v9

    invoke-virtual {v9}, Landroid/location/Location;->getLongitude()D

    move-result-wide v9

    invoke-static/range {v3 .. v11}, Landroid/location/Location;->distanceBetween(DDDD[F)V

    .line 277
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->this$0:Lcom/peptalk/client/lbs/android/LbsManager;

    move-object v3, v0

    move-object v0, v3

    move-object/from16 v1, v18

    invoke-static {v0, v1}, Lcom/peptalk/client/lbs/android/LbsManager;->access$15(Lcom/peptalk/client/lbs/android/LbsManager;Landroid/location/Location;)V

    .line 278
    const/4 v3, 0x0

    aget v3, v11, v3

    move-object/from16 v0, p0

    iget v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->minDistance:F

    move v4, v0

    cmpl-float v3, v3, v4

    if-lez v3, :cond_0

    .line 279
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/peptalk/client/lbs/android/LbsManager$LbsTimerTask;->listener:Landroid/location/LocationListener;

    move-object v3, v0

    move-object v0, v3

    move-object/from16 v1, v18

    invoke-interface {v0, v1}, Landroid/location/LocationListener;->onLocationChanged(Landroid/location/Location;)V
    :try_end_0
    .catch Ljavax/xml/parsers/ParserConfigurationException; {:try_start_0 .. :try_end_0} :catch_2
    .catch Lorg/xml/sax/SAXException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 286
    .end local v11           #results:[F
    .end local v12           #acc:Ljava/lang/String;
    .end local v13           #builder:Ljavax/xml/parsers/DocumentBuilder;
    .end local v14           #dbf:Ljavax/xml/parsers/DocumentBuilderFactory;
    .end local v15           #doc:Lorg/w3c/dom/Document;
    .end local v16           #is:Ljava/io/InputStream;
    .end local v17           #lat:Ljava/lang/String;
    .end local v19           #lon:Ljava/lang/String;
    .end local v20           #root:Lorg/w3c/dom/Element;
    .end local v21           #xml:Ljava/lang/String;
    :cond_0
    :goto_0
    return-void

    .line 284
    :catch_0
    move-exception v3

    goto :goto_0

    .line 283
    :catch_1
    move-exception v3

    goto :goto_0

    .line 282
    :catch_2
    move-exception v3

    goto :goto_0
.end method
